﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_UptGpwf : System.Web.UI.Page
{
    private string gnum;
    private string ku;
    private string guige;
    private string banzu;
    private string cday;
    protected void Page_Load(object sender, EventArgs e)
    {

        gnum = Request.QueryString["Gnum"];
        DataSet ds = BLLFactory.CreateGpwfBLL().Select(gnum);
        ku = ds.Tables[0].Rows[0]["ku"].ToString();
        txtKu.Text = ku;
        txtKu.Attributes["contentEditable"] = "false";
        guige = ds.Tables[0].Rows[0]["guige"].ToString();
        txtGuige.Text = guige;
        txtGuige.Attributes["contentEditable"] = "false";
        banzu = ds.Tables[0].Rows[0]["banzu"].ToString();

        string jltime = ds.Tables[0].Rows[0]["gday"].ToString();
        cday = Convert.ToDateTime(jltime).ToShortDateString();
        if (!IsPostBack)
        {
            
            txtSl.Text = ds.Tables[0].Rows[0]["sl"].ToString();
            txtNR.Text = ds.Tables[0].Rows[0]["neirong"].ToString();
            
        }
        

    }
    protected void btnUpt_Click(object sender, EventArgs e)
    {
        int f = BLLFactory.CreateGpwfBLL().Update(gnum, txtNR.Text.ToString(), Convert.ToDecimal(txtSl.Text.ToString()));
        if (f >= 1)
            Response.Write(" <script   language=javascript> window.alert( ' 修改成功！ ');</script> ");
        Response.Redirect(string.Format("GPWFJL.aspx?Banzu={0}&Cday={1}", banzu, cday));
    }
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int f = BLLFactory.CreateGpwfBLL().Del(gnum);
        if (f >= 1)
            Response.Write(" <script   language=javascript> window.alert( ' 删除成功！ ');</script> ");
        Response.Redirect(string.Format("GPWFJL.aspx?Banzu={0}&Cday={1}", banzu, cday));
    }
}
